/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.catosist.run.business.gestorConstante;

import com.catosist.run.dataaccess.domain.ConstanteDao;
import com.catosist.run.dataaccess.model.ConstanteVO;
import com.catosist.run.services.ConstanteDTO;
import java.util.List;

/**
 *
 * @author igorov
 */
public class GestorConstanteImpl implements GestorConstante{

    private ConstanteDao constanteDao;

    public ConstanteDao getConstanteDao() {
        return constanteDao;
    }

    public void setConstanteDao(ConstanteDao constanteDao) {
        this.constanteDao = constanteDao;
    }

    public void deleteById(int i) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public void deleteByIndex(int index) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public List<ConstanteDTO> getAll() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public ConstanteDTO getById(int voId) {
        ConstanteVO constanteVO = constanteDao.get(voId);
        return new ConstanteDTO(constanteVO.getId(), constanteVO.getNombre(), constanteVO.getPorcentaje());
    }

    public ConstanteDTO getByIndex(int indice) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public int getIdAtIndex(int indice) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public int getIndexOf(int voId) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public void saveOrUpdate(ConstanteDTO o) {
        ConstanteVO constanteVO = new ConstanteVO();
        constanteVO.setId(o.getId());
        constanteVO.setNombre(o.getNombre());
        constanteVO.setPorcentaje(o.getPorcentaje());

        constanteDao.saveOrUpdate(constanteVO);
    }

    public void updateListVo() {
        throw new UnsupportedOperationException("Not supported yet.");
    }


}
